package net.wanho.commons.vo;

public class AjaxResult {
    /**响应状态码  比如: true 成功 false 失败*/
    private boolean flag ;
    /**响应状态码  比如: 200 成功   500 失败*/
    private int code ;
    /**提示消息  比如: 操作成功  操作失败*/
    private String msg ;
    /**响应数据[查询结果集中使用]*/
    private Object data ;

    public AjaxResult(boolean flag, int code, String msg, Object data) {
        super();
        this.flag = flag;
        this.code = code;
        this.msg = msg;
        this.data = data;
    }
    public boolean isFlag() {
        return flag;
    }
    public int getCode() {
        return code;
    }
    public String getMsg() {
        return msg;
    }
    public Object getData() {
        return data;
    }

    public static AjaxResult success() {
        return new  AjaxResult(true,200,"操作成功",null) ;
    }

    public static AjaxResult success(Object data) {
        return new  AjaxResult(true,200,"操作成功",data) ;
    }

    public static AjaxResult fail() {
        return new  AjaxResult(false,500,"操作失败",null) ;
    }

    public static AjaxResult fail(Object data) {
        return new  AjaxResult(false,500,"操作失败",data) ;
    }

}
